#include<stdio.h>
#include<sys/types.h>
#include<stdlib.h>
#include<unistd.h>
int main()
{
  printf("原进程pid：%d . ppid：%d\n", getpid() , getppid());
  int pid = fork();
  if(pid == 0 )
  {
    while(1)
    {
      printf("子进程pid：%d,ppid：%d\n",getpid(),getppid());
      sleep(1);
    }
  }
  else if(pid > 0)
  {
    while(1)
    {
      printf("父进程pid：%d , ppid：%d\n",getpid(),getppid());
      sleep(1);
    }
  }
  return 0;
}
